package cn.pengpeng.day07.topn3;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * 分区的：
 * 把想要的数据分到相同的reduce里面
 * @author root
 *
 */
public class MyPartition extends Partitioner<MovieBean, NullWritable>{
	/**
	 * munPartitions 代表有多少个reducetask
	 * key map端输出的key
	 * value map端输出的value
	 */
	@Override
	public int getPartition(MovieBean key, NullWritable value, int numPartitions) {
		return (key.getMovie().hashCode() & Integer.MAX_VALUE)%numPartitions;
	}

}
